package kr.ac.kaist.savehearts.ui;

import java.util.ArrayList;

import kr.ac.kaist.savehearts.auth.UserInfo;
import kr.ac.kaist.savehearts.status.StatusUpdateListener;
import kr.ac.kaist.savehearts.status.UserStatusUpdater;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.util.Linkify;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class LoginActivity extends Activity 
	implements OnTouchListener, StatusUpdateListener {

	private static final String TAG = LoginActivity.class.getSimpleName();
	
	private EditText editTextEmail;
	private EditText editTextPassword;
	private Button buttonCancel;
	private Button buttonOk;
	private TextView textViewForgotPassword;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.login);
		
		editTextEmail = (EditText)findViewById(R.id.editTextLoginEmail);		
		editTextPassword = (EditText)findViewById(R.id.EditTextLoginPassword);
		
		buttonOk = (Button)findViewById(R.id.buttonLoginOk);
		buttonOk.setOnTouchListener(this);
				
		buttonCancel = (Button)findViewById(R.id.buttonLoginCancel);
		buttonCancel.setOnTouchListener(this);
		
		textViewForgotPassword = (TextView)findViewById(R.id.textViewLoginForgetPassword);
		textViewForgotPassword.setOnTouchListener(this);
		String viewURL = "url://activity...";
		Linkify.addLinks(textViewForgotPassword, Linkify.ALL);
	}


	@Override
	public boolean onTouch(View view, MotionEvent event) {
		Intent myIntent;
		switch (view.getId()) {
			case R.id.buttonLoginOk:
				
				break;
				
			case R.id.buttonLoginCancel:
				finish();
				break;
				
			case R.id.textViewLoginForgetPassword:
				myIntent = new Intent(LoginActivity.this, ResetPasswordActivity.class);
				startActivity(myIntent);
				break;
		}
		return false;
	}


	@Override
	public void neighborUpdated(ArrayList<UserInfo> neighbors) {
		// TODO Auto-generated method stub
		
	}


	@Override
	public void responseReceived(RequestType reqType, int response) {
		// TODO Auto-generated method stub
		
	}

}
